<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Reservation extends Model
{
    use HasFactory;
    protected $table='reservation';
    protected $dateFormat='U';
    protected $fillable=['email','mobile','start_time','contact_name','product_id','reservation_on','users_id'];

    public function product()
    {
        return $this->hasOne(Products::class,'id','product_id');
    }

    public function user()
    {
        return $this->hasOne(Users::class,'id','users_id');
    }

    public function getStartTimeAttribute($value)
    {
        return date('Y-m-d H:i',$value);
    }
}
